<template>
	<view class="container">
		<view class="main" v-if="data">
			<view class="route">
				<view class="text">{{data.start_city}} {{data.start_district}}</view>
				<image class="direc" src="../../../static/images/cust_direc.png"></image>
				<view class="text">{{data.end_city}} {{data.end_district}}</view>
			</view><!--route end-->
			<view class="section">
				<view class="text">出发时间：</view>
				<view class="value">{{data.start_time}}</view>
			</view><!--section end-->
			<view class="section">
				<view class="text">A费：</view>
				<view class="value">¥{{data.amount}}元/座</view>
			</view><!--section end-->
			<view class="section">
				<view class="text">余座：</view>
				<view class="value">{{data.has_location}}座</view>
			</view><!--section end-->
		</view><!--main end-->
		<view class="sub" v-if="data">
			<view class="title">乘客信息</view>
			<view class="subs">
				<view class="item" v-for="item in data.subs">
					<image class="avatar" src="../../../static/images/f.png"></image>
					<view class="right">
						<view class="name">罗伟</view>
						<view class="num">订座数：{{item.num}}人</view>
						<view class="remark">备注：{{item.remark}}</view>
					</view>
					<view class="call_bg">
						<image class="call" src="../../../static/images/call.png"></image>
					</view>
				</view><!--item end-->
			</view>
		</view><!--main end-->
		<view class="btns" style="display: none;">
			<view class="btn" @click="commentEvent()">评价司机</view>
			<view class="btn">分享行程</view>
		</view><!--btns end-->
	</view>
</template>

<script>
	import {travel_detail} from '@/api/travel';
	export default {
		data() {
			return {
				id:0,
				data:undefined
				
			}
		},
		onLoad(options) {
			this.id = options.id;
			this.getData();
		},
		methods: {
			//预订行程
			commentEvent(){
				uni.navigateTo({
					url:'/pages/main/query/subscribe?id='+this.id+'&has_location='+this.has_location
				})
			},
			getData() {
				let that = this;
				uni.showLoading({
					title:'加载中...'
				});
				travel_detail(that.id).then(res => {
					uni.hideLoading();
					that.data = res.data;
				}).catch(err => {
					uni.hideLoading();
					return that.$util.Tips({
						title: err
					})
				});
				
			}
		}
	}
</script>

<style scoped lang="scss">
	page{
		background-color: #f2f2f2;
	}
	.container{
		display: flex;
		flex-direction: column;
		padding-bottom: 0;
		padding-bottom: constant(safe-area-inset-bottom);  
		padding-bottom: env(safe-area-inset-bottom); 
		.main{
			display: flex;
			flex-direction: column;
			padding: 30rpx;
			margin-left: 30rpx;
			margin-right: 30rpx;
			margin-top: 30rpx;
			border-radius: 10rpx;
			background-color: white;
			.route{
				display: flex;
				flex-direction: row;
				border-bottom: 1rpx solid #f1f1f1;
				height: 80rpx;
				padding-left: 30rpx;
				.text{
					font-size: 32rpx;
					font-weight: bold;
					color: black;
				}
				.direc{
					width: 50rpx;
					height: 50rpx;
					margin-left: 10rpx;
					margin-right: 10rpx;
				}
			}//add_main end
			.section{
				margin-top: 20rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				background-color: white;
				padding: 10rpx 30rpx;
				.text{
					color: black;
					font-size: 28rpx;
					width: 130rpx;
				}
				.value{
					margin-left: 20rpx;
					color: dimgray;
					font-size: 28rpx;
				}
			}
		}//main end
		
		.sub{
			padding: 30rpx;
			margin-left: 30rpx;
			margin-right: 30rpx;
			margin-top: 30rpx;
			background-color: white;
			margin-bottom: 100rpx;
			.title{
				height: 80rpx;
				line-height: 80rpx;
				font-weight: bold;
				font-size: 30rpx;
			}
			.subs{
				display: flex;
				flex-direction: column;
				.item{
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					padding-bottom: 30rpx;
					
					.avatar{
						width: 80rpx;
						height:80rpx;
						border-radius: 40rpx;
					}
					.right{
						flex: 1;
						margin-left: 30rpx;
						margin-right: 30rpx;
						.name{
							color: black;
							font-size: 28rpx;
							font-weight: bold;
						}
						.num{
							color: gray;
							font-size: 26rpx;
							margin-top: 10rpx;
						}
						.remark{
							color: gray;
							font-size: 26rpx;
							margin-top: 10rpx;
						}
					}
					.call_bg{
						width: 100rpx;
						display: flex;
						flex-direction: row;
						justify-content: flex-end;
						align-items: center;
						.call{
							width: 60rpx;
							height: 60rpx;
						}
					}
				}
			}
		}
		
		.btns{
			margin-top: 50rpx;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			margin-left: 30rpx;
			margin-right: 30rpx;
			margin-bottom: 100rpx;
			.btn{
				background-color: #dd783f;
				color: white;
				font-size: 28rpx;
				height: 80rpx;
				width: 48%;
				text-align: center;
				line-height: 80rpx;
			}
		}
		
		.footer{
			height: 80rpx;
			width: 100%;
			position: fixed;
			right: 0;
			bottom: 0;
			left: 0;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: center;
			padding-bottom: 0;  
			padding-bottom: constant(safe-area-inset-bottom);  
			padding-bottom: env(safe-area-inset-bottom); 
			.submit-btn{
				background-color: $uni-main-color;
				color: white;
				font-size: 28rpx;
				height: 80rpx;
				width: 100%;
				text-align: center;
				line-height: 80rpx;
			}
		}// end footer
		/** 弹窗 **/
		.popup-cls{
			display: flex;
			flex-direction: column;
			.pop-info{
				width:100%;
				display: flex;
				flex-direction: column;
				border-radius: 20rpx;
				margin: 0 auto;
				background-color: white;
				.pop-top{
					display: flex;
					flex-direction: row;
					justify-content: space-around;
					align-items: center;
					font-size: 28rpx;
					color: #000000;
					font-weight: bold;
					margin-top: 20rpx;
					text-align: center;
					height: 40rpx;
				}
			}
			
			.center{
				margin-top: 30rpx;
				width:100%;
				padding: 0rpx 0rpx;
				display: flex;
				flex-direction: column;
				.warning{
					color: darkorange;
					font-size: 28rpx;
					padding: 0 30rpx;
				}
				.pop-content{
					display: flex;
					flex-direction: column;
					height: 700rpx;
					margin-top: 30rpx;
					.list{
						display: flex;
						flex-direction: column;
						.top{
							display: flex;
							flex-direction: row;
							padding: 0 30rpx;
							.red{
								color: red;
							}
							.title{
								font-size: 28rpx;
								font-weight: bold;
								color: black;
							}
							.desc{
								font-size: 28rpx;
								color: gray;
							}
						}
						.bottom{
							display: flex;
							flex-direction: row;
							flex-wrap: wrap;
							margin-top: 20rpx;
							// padding-left: 10rpx;
							.item{
								color: black;
								height:70rpx;
								line-height: 70rpx;
								margin-left: 30rpx;
								font-weight: bold;
							}
							.item-body{
								display: flex;
								flex-direction: row;
								flex-wrap: wrap;
								margin-top: 20rpx;
								.item-i{
									width: 16%;
									background-color: #f2f2f2;
									color: black;
									text-align: center;
									height:60rpx;
									line-height: 60rpx;
									margin-bottom: 20rpx;
									border-radius: 10rpx;
									border: 1rpx solid #f2f2f2;
									margin-left: 20rpx;
								}
								.item_selected{
									border: 1rpx solid orange;
									background-color: blanchedalmond;
									color: orange;
								}
							}
							//不能选择
							.item_unselected{
								border: 1rpx solid #f2f2f2;
								background-color: #f2f2f2;
								color: gray;
							}
						}
					}
				}
				//pop-content
				.btn{
					background-color: $uni-main-color;
					color: white;
					font-size: 28rpx;
					height: 80rpx;
					width: 100%;
					text-align: center;
					line-height: 80rpx;
				}
			}//center
			
		}//popup-cls end
	}
	
</style>
